package com.dddd.blog.blogpost;


import com.dddd.blog.api.post.pojo.Post;
import com.dddd.blog.blogcommon.pojo.vo.PostVO;
import com.dddd.blog.blogpost.service.IPostService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@SpringBootTest
@RunWith(SpringRunner.class)
public class BlogPostTest02 {


    @Resource
    private IPostService postService;

    @Test
    public void test01(){
        List<Map<String, Object>> readRank = postService.getReadRank();
        readRank.forEach(System.out::println);
    }

    // TODO
    @Test
    public void test02(){
        List<Post> list = postService.getPostListByPage(1, 10);
        list.forEach(System.out::println);
    }

    @Test
    public void test03(){
        List<Map<String, Object>> list = postService.getReadRank();
        list.forEach(System.out::println);
    }

    @Test
    public void test04(){
        PostVO postVO = postService.getPostById(6L);
        System.out.println(postVO);
    }

    @Test
    public void test05(){
        List<Post> list = postService.getPostOrderByRead();
        list.forEach(System.out::println);
    }

    @Test
    public void test06(){
        List<Map<String, Object>> list = postService.getHotByAuthor("zblade");
        list.forEach(System.out::println);
    }

}
